module.exports = function(app) {
  var express = require('express');
  var treenodesRouter = express.Router();
  var generatedId = 10000;

  treenodesRouter.put('/:tid/update', function(req, res) {
    var tid = req.params.tid,
      body = req.body;
    body.generatedNodeId = ++generatedId;
    console.log(req.body.action);
    res.json(body);
  });
  app.use('/treenodes',require('body-parser').json(), treenodesRouter);
};
